#!/usr/bin/env python

import ConfigParser
import sink
import os

def stupidConfig(config):
    a={}
    for atts in config: a.update({atts[0]:atts[1]})
    return a
def getSinks(file):
    s=[]
    config = ConfigParser.ConfigParser()
    config.read([file])
    for section in config.sections():
        module = __import__("sinks.%s"%section.lower(), globals(), locals(), section.lower())
        s.append(getattr(module, "sink")(stupidConfig(config.items(section))))
    return s
def run(sinks):
    sink.init(sinks)
    #while 1: sink.loop(sinks)
        
if os.path.isfile("config"): run(getSinks("config"))